<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>绑定账号</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<script>
		//var wxUser='${wxUser}';
		//if(""==wxUser || null==wxUser){
		//	location.href="../../index.html";
		//}
	</script>
    <link rel="stylesheet" href="../../assets/css/amazeui.min.css">
    <link rel="stylesheet" href="../../assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="../../assets/css/index.css?v=2.3">
</head>
<body >
<header data-am-widget="header" class="am-header am-header-default am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="history.go(-1)"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title" >
        绑定账号
    </h1>

</header>
<section class="" id="amz-main" data-tag="css-nav">

    <div class="div-logo"></div>

    <ul class="am-list am-list-static am-list-border margin-top-20 register">
        <li class="am-padding-left-xl">
            <i class="icon_1"></i>
            <input type="tel" class="" id="telphone"  placeholder="输入您的手机号"></li>
        <li  class="am-padding-left-xl ">
            <i class="icon_2"></i>
            <input type="tel"  class="" id="code" placeholder="输入4位手机验证码">
            <i class="validate_btn" onclick="createCode()">获取验证码</i>
        </li>
    </ul>

    <div class="am-g am-g-fixed  font-14 bd-phone margin-top-20 ">
        <div class="am-u-sm-12  am-text-center">
            <button type="button" class="am-btn am-btn-warning am-btn-block" onclick="loginBind()">立即登录</button>
        </div>
    </div>

</section>

<script src="../../assets/js/jquery.min.js"></script>
<script src="../../assets/js/amazeui.min.js"></script>
<script>
function createCode(){
	var telphone=$("#telphone").val();
	var baseResponse=$.ajax({url:"../../sendAuthCode?telphone="+telphone,async:false});
  	var sendAuthCode=JSON.parse(baseResponse.responseText);
   	if(sendAuthCode.resultCode=="0"){
   		alert("图片变灰色");
   		$(".validate_btn").addClass("opacity_bg");
   	}else{
   		alert(sendAuthCode.resultDesc);
   	}
	
}
function loginBind(){
	var telphone=$("#telphone").val();
	var code=$("#code").val();
	var baseResponse=$.ajax({url:"../../isAuthCode?telphone="+telphone+"&code="+code,async:false});
  	var isAuthCode=JSON.parse(baseResponse.responseText);
   	if(isAuthCode.resultCode=="0"){
   		location.href="../../loginBind?telphone="+telphone+"&code="+code;
   	}else{
   		alert(isAuthCode.resultDesc);
   	}
}
</script>
</body>
</html>